package io.github.yotta.logger.example.context;

import io.github.yotta.common.web.advice.ResponseWrapper;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;

/**
 * @author yotta
 * @date 2025/3/12 18:37
 */
@Component
public class MyResponseWrapper implements ResponseWrapper {

    @Override
    public Object wrapperResponse(Object o, Class aClass) {
        Map<String, Object> map = new HashMap<>();
        map.put("mydata", o);
        map.put("code", 20000);
        return map;
    }

    @Override
    public Object wrapperErrorResponse(String s, HttpStatus httpStatus, Exception e) {
        return null;
    }
}
